package com.cysion.study.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.cysion.study.ktbox.base.BaseAdapter
import com.cysion.study.ktbox.base.BaseViewHolder
import com.cysion.study.R
import com.cysion.study.entity.BlanceDetailEntity
import kotlinx.android.synthetic.main.item_blance_detail.view.*

class BlanceDetailAdapter(mEntities: MutableList<BlanceDetailEntity>, mContext: Context) :
    BaseAdapter<BlanceDetailEntity>(mEntities, mContext) {

    companion object {

        //点击事件
        const val refuse = 2000
        const val agree = 2001
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder<BlanceDetailEntity> {
        return ProMoneyHolder(
            LayoutInflater.from(mContext).inflate(R.layout.item_blance_detail, parent, false)
        )
    }

    class ProMoneyHolder(itemView: View) : BaseViewHolder<BlanceDetailEntity>(itemView) {
        override fun fillData(obj: BlanceDetailEntity, position: Int) {
            itemView?.apply {
                //                itemView.tv_data.text=
//                tv_time.text = obj.createTime
                /*itemView.setOnClickListener {
                    mOnTypeClickListener?.invoke(obj, position, ITEM_CLICK)
                }*/
                tv_title.text=obj.title
                tv_money.text=obj.money
                tv_time.text=obj.createTime
                //category":1, //余额分类 0.增加余额 1.减少余额
                if (obj.category == "0") {
                    tv_type.text = "+"
                } else {
                    tv_type.text = "-"
                }

            }

        }

    }
}